<template>
  <div class="person">
    <h2>姓名：{{person.name}}</h2>
    <h2>年龄：{{person.age}}</h2>
    <button @click="ChangeName">修改名字</button>
    <button @click="ChangeAge">修改年龄</button>


  </div>
</template>

<script setup name="Person">
import {reactive, toRefs} from 'vue'

let person=reactive({
  name:'小宇',
  age:18,
  tel:88888888888
 })

let{name,age}=toRefs(person)
console.log(person)


function ChangeName(){
  name.value='xiaoyu'
}
function ChangeAge(){
  age.value+=1
}
</script>

<style>
.person {
  background-color: burlywood;
  box-shadow: 0 0 10px;
  border-radius: 10px;
  padding: 10px;
}
</style>
